package authentication.manager.factory;

import authentication.manager.TokenManager;
import authentication.manager.impl.TokenMangerPersistence;

public class TokenManagerFactory {
	/**
	 * 默认方法
	 * */
	public TokenManager getTokenManger(Class clazz){
		TokenManager tokenManager=null;
		try {
			tokenManager = (TokenManager)clazz.newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}  
		
		return tokenManager;
	}
	public static TokenManager getInstance(){
		TokenManager tokenManager =null;
		try {
			Class clazz =TokenMangerPersistence.class;
			
			tokenManager= (TokenManager)clazz.newInstance();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return tokenManager;
	}
}
